/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.converter;

import br.com.deployment.entidade.registroimovel.Imovel;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author roniere
 */
@FacesConverter(value="imovelConverter")
public class ImovelConverter implements Converter{
    
    @Override
    public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
        Imovel imovel = new Imovel();
        imovel.setId(Integer.valueOf(string));  
        
        return imovel;
    }

    @Override
    public String getAsString(FacesContext fc, UIComponent uic, Object value) {
        Imovel imovel = (Imovel) value;
        return "" + imovel.getId();
    }

}
